﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VLUSM_BusinessLogic.DataTransferObjects;
using VLUSM_DataAccess;
using AutoMapper;
using System.Collections.ObjectModel;

namespace VLUSM_BusinessLogic.Helpers
{
    public static class Converter
    {
        #region Configuration
        public static void ConfigureCauLacBoMapping()
        {
            Mapper.CreateMap<CauLacBo, CauLacBoDTO>();
            Mapper.CreateMap<CauLacBoDTO, CauLacBo>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.CauLacBoThamGias, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureCauLacBoThamGiaMapping()
        {
            Mapper.CreateMap<CauLacBoThamGia, CauLacBoThamGiaDTO>()
                .ForMember(c => c.TenGoi, o => o.MapFrom(s => s.CauLacBo.TenGoi));
            Mapper.CreateMap<CauLacBoThamGiaDTO, CauLacBoThamGia>().IgnoreAllNonExisting();
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureChinhSachMapping()
        {
            Mapper.CreateMap<ChinhSach, ChinhSachDTO>();
            Mapper.CreateMap<ChinhSachDTO, ChinhSach>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.SinhViens, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureDanTocMapping()
        {
            Mapper.CreateMap<DanToc, DanTocDTO>();
            Mapper.CreateMap<DanTocDTO, DanToc>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.SinhViens, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureDonViMapping()
        {
            Mapper.CreateMap<DonVi, DonViDTO>();
            Mapper.CreateMap<DonViDTO, DonVi>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.Quyens, o => o.Ignore())
                .ForMember(d => d.Users, o => o.Ignore())
                .ForMember(d => d.Lops, o => o.Ignore())
                .ForMember(d => d.PhienBanGiaos, o => o.Ignore())
                .ForMember(d => d.LoaiHoSoes, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureDVHCCap1Mapping()
        {
            Mapper.CreateMap<DVHCCap1, DVHCCap1DTO>();
            Mapper.CreateMap<DVHCCap1DTO, DVHCCap1>()
                .ForMember(d => d.Cap2, o => o.Ignore())
                .ForMember(d => d.EntityKey, o => o.Ignore());
            Mapper.CreateMap<DVHCCap1, DVHCCap1DetailDTO>().ForMember(d => d.DVHCCap2, o => o.Ignore());
            //Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureDVHCCap2Mapping()
        {
            Mapper.CreateMap<DVHCCap2, DVHCCap2DTO>();
            Mapper.CreateMap<DVHCCap2DTO, DVHCCap2>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.Cap1Reference, o => o.Ignore())
                .ForMember(d => d.Cap1, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureHoatDongDoanTheMapping()
        {
            Mapper.CreateMap<HoatDongDoanThe, HoatDongDoanTheDTO>();
            Mapper.CreateMap<HoatDongDoanTheDTO, HoatDongDoanThe>()
                .IgnoreAllNonExisting();
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureHoatDongDoanTheThamGiaMapping()
        {
            Mapper.CreateMap<HoatDongDoanTheThamGia, HoatDongDoanTheThamGiaDTO>()
                .ForMember(h => h.TenGoi, o => o.MapFrom(s => s.HoatDongDoanThe.TenGoi));
            Mapper.CreateMap<HoatDongDoanTheThamGiaDTO, HoatDongDoanTheThamGia>().IgnoreAllNonExisting();
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureHocBongMapping()
        {
            Mapper.CreateMap<HocBong, HocBongDTO>();
            Mapper.CreateMap<HocBongDTO, HocBong>().IgnoreAllNonExisting();
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureHoSoDaNopMapping()
        {
            Mapper.CreateMap<HoSoNopList, HoSoDaNopDTO>()
                .IgnoreAllNonExisting();

            Mapper.CreateMap<HoSoDaNop, HoSoDaNopDTO>()
                .ForMember(d => d.TenLoaiHoSo, o => o.MapFrom(s => s.LoaiHoSo.TenGoi))
                .IgnoreAllNonExisting();
            Mapper.CreateMap<HoSoDaNopDTO, HoSoDaNop>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.LoaiHoSo, o => o.Ignore())
                .ForMember(d => d.LoaiHoSoReference, o => o.Ignore())
                .ForMember(d => d.SinhVien, o => o.Ignore())
                .ForMember(d => d.SinhVienReference, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureKhenThuongMapping()
        {
            Mapper.CreateMap<KhenThuong, KhenThuongDTO>();
            Mapper.CreateMap<KhenThuongDTO, KhenThuong>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.SinhVien, o => o.Ignore())
                .ForMember(d => d.SinhVienReference, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureKhoaHocMapping()
        {
            Mapper.CreateMap<KhoaHoc, KhoaHocDTO>();
            Mapper.CreateMap<KhoaHocDTO, KhoaHoc>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.Lops, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureKyLuatMapping()
        {
            Mapper.CreateMap<KyLuat, KyLuatDTO>();
            Mapper.CreateMap<KyLuatDTO, KyLuat>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.SinhVien, o => o.Ignore())
                .ForMember(d => d.SinhVienReference, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureLoaiHoSoMapping()
        {
            Mapper.CreateMap<LoaiHoSo, LoaiHoSoDTO>()
                .ForMember(d => d.IsBatBuoc, o => o.Ignore())
                .ForMember(d => d.IsSuDung, o => o.Ignore());
            Mapper.CreateMap<LoaiHoSoDTO, LoaiHoSo>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.HoSoDaNops, o => o.Ignore())
                .ForMember(d => d.DonVis, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureLoaiThayDoiMapping()
        {
            Mapper.CreateMap<LoaiThayDoi, LoaiThayDoiDTO>();
            Mapper.CreateMap<LoaiThayDoiDTO, LoaiThayDoi>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.ThayDoiTrongQuaTrinhHocs, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureLoaiVanBangMapping()
        {
            Mapper.CreateMap<LoaiVanBang, LoaiVanBangDTO>();
            Mapper.CreateMap<LoaiVanBangDTO, LoaiVanBang>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.VanBangDuocNhans, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureLopMapping()
        {
            Mapper.CreateMap<Lop, LopDTO>()
                .ForMember(d => d.DonViTen, o => o.MapFrom(s => s.DonVi.TenGoi))
                .ForMember(d => d.KhoaTen, o => o.MapFrom(s => s.KhoaHoc.TenGoi));
            Mapper.CreateMap<LopDTO, Lop>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.DonVi, o => o.Ignore())
                .ForMember(d => d.KhoaHoc, o => o.Ignore())
                .ForMember(d => d.SinhVien, o => o.Ignore())
                .ForMember(d => d.DonViReference, o => o.Ignore())
                .ForMember(d => d.KhoaHocReference, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureMonHocMapping()
        {
            Mapper.CreateMap<MonHoc, MonHocDTO>();
            Mapper.CreateMap<MonHocDTO, MonHoc>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.Diems, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureNghienCuuKhoaHocMapping()
        {
            Mapper.CreateMap<NghienCuuKhoaHoc, NghienCuuKhoaHocDTO>();
            Mapper.CreateMap<NghienCuuKhoaHocDTO, NghienCuuKhoaHoc>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.SinhVien, o => o.Ignore())
                .ForMember(d => d.SinhVienReference, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureNhatKyMapping()
        {
            Mapper.CreateMap<NhatKy, NhatKyDTO>();
            Mapper.CreateMap<NhatKyDTO, NhatKy>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.SinhVien, o => o.Ignore())
                .ForMember(d => d.SinhVienReference, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigurePhienBanGiaoMapping()
        {
            Mapper.CreateMap<PhienBanGiao, PhienBanGiaoDTO>();
            Mapper.CreateMap<PhienBanGiaoDTO, PhienBanGiao>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.DonVi, o => o.Ignore())
                .ForMember(d => d.DonViReference, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureQuyenMapping()
        {
            Mapper.CreateMap<Quyen, QuyenDTO>();
            Mapper.CreateMap<QuyenDTO, Quyen>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.DonVis, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureSinhVienMapping()
        {
            Mapper.CreateMap<CMND, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.CMND>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.CMND, CMND>();

            Mapper.CreateMap<Lop10, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.Lop10>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.Lop10, Lop10>();

            Mapper.CreateMap<Lop11, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.Lop11>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.Lop11, Lop11>();

            Mapper.CreateMap<Lop12, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.Lop12>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.Lop12, Lop12>();

            Mapper.CreateMap<TotNghiepPhoThong, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.TotNghiepPhoThong>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.TotNghiepPhoThong, TotNghiepPhoThong>();

            Mapper.CreateMap<QuaTrinhHocPhoThong, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.QuaTrinhHocPhoThong>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.QuaTrinhHocPhoThong, QuaTrinhHocPhoThong>();

            Mapper.CreateMap<DiaChiLienLac, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.DiaChiLienLac>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.DiaChiLienLac, DiaChiLienLac>();

            Mapper.CreateMap<DiaChiTamTru, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.DiaChiTamTru>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.DiaChiTamTru, DiaChiTamTru>();

            Mapper.CreateMap<DiaChiThuongTru, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.DiaChiThuongTru>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.DiaChiThuongTru, DiaChiThuongTru>();

            Mapper.CreateMap<LienLac, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.LienLac>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.LienLac, LienLac>();

            Mapper.CreateMap<NguoiCha, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.NguoiCha>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.NguoiCha, NguoiCha>();

            Mapper.CreateMap<NguoiMe, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.NguoiMe>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.NguoiMe, NguoiMe>();

            Mapper.CreateMap<QuanHeGiaDinh, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.QuanHeGiaDinh>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.QuanHeGiaDinh, QuanHeGiaDinh>();

            Mapper.CreateMap<SinhHoatDang, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.SinhHoatDang>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.SinhHoatDang, SinhHoatDang>();

            Mapper.CreateMap<SinhHoatDoan, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.SinhHoatDoan>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.SinhHoatDoan, SinhHoatDoan>();

            Mapper.CreateMap<KetQuaTuyenSinh, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.KetQuaTuyenSinh>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.KetQuaTuyenSinh, KetQuaTuyenSinh>();

            Mapper.CreateMap<ThongTinKhac, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.ThongTinKhac>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.ThongTinKhac, ThongTinKhac>();

            Mapper.CreateMap<TotNghiepDaiHoc, VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.TotNghiepDaiHoc>();
            Mapper.CreateMap<VLUSM_BusinessLogic.DataTransferObjects.SinhVienProperty.TotNghiepDaiHoc, TotNghiepDaiHoc>();

            Mapper.CreateMap<SinhVien, SinhVienBasicDTO>()
                .ForMember(d => d.DonViTen, o => o.MapFrom(s => s.Lop.DonVi.TenGoi))
                .ForMember(d => d.LopTen, o => o.MapFrom(s => s.Lop.TenGoi))
                .ForMember(d => d.DonViID, o => o.MapFrom(s => s.Lop.DonViID));
            Mapper.CreateMap<SinhVienBasicDTO, SinhVien>()
                .IgnoreAllNonExisting();
            Mapper.CreateMap<SinhVien, SinhVienDetailDTO>()
                .ForMember(d => d.DanhSachCauLacBo, o => o.Ignore())
                .ForMember(d => d.DanhSachHoatDongDoanThe, o => o.Ignore())
                .ForMember(d => d.DanhSachHocBong, o => o.Ignore())
                .ForMember(d => d.DanhSachHoSoDaNop, o => o.Ignore())
                .ForMember(d => d.DanhSachNghienCuuKhoaHoc, o => o.Ignore())
                .ForMember(d => d.DanhSachNhatKy, o => o.Ignore())
                .ForMember(d => d.DanhSachThamGiaOlympic, o => o.Ignore())
                .ForMember(d => d.DanhSachThayDoi, o => o.Ignore())
                .ForMember(d => d.DanhSachKhenThuong, o => o.Ignore())
                .ForMember(d => d.DanhSachKyLuat, o => o.Ignore())
                .ForMember(d => d.DanhSachThayDoi, o => o.Ignore())
                .ForMember(d => d.DanhSachVanBang, o => o.Ignore())
                .ForMember(d => d.DonViID, o => o.MapFrom(s => s.Lop.DonViID));
            Mapper.CreateMap<SinhVienDetailDTO, SinhVien>()
                .ForMember(d => d.ChinhSach, o => o.Ignore())
                .ForMember(d => d.ChinhSachReference, o => o.Ignore())
                .ForMember(d => d.DanToc, o => o.Ignore())
                .ForMember(d => d.DanTocReference, o => o.Ignore())
                .ForMember(d => d.TonGiao, o => o.Ignore())
                .ForMember(d => d.TonGiaoReference, o => o.Ignore())
                .ForMember(d => d.VanBangDuocNhans, o => o.Ignore())
                .ForMember(d => d.LopReference, o => o.Ignore())
                .ForMember(d => d.Lop, o => o.Ignore())
                .ForMember(d => d.HoatDongDoanTheThamGias, o => o.Ignore())
                .ForMember(d => d.KhenThuongs, o => o.Ignore())
                .ForMember(d => d.KyLuats, o => o.Ignore())
                .ForMember(d => d.HocBongs, o => o.Ignore())
                .ForMember(d => d.NghienCuuKhoaHocs, o => o.Ignore())
                .ForMember(d => d.ThayDoiTrongQuaTrinhHocs, o => o.Ignore())
                .ForMember(d => d.ThamGiaOlympics, o => o.Ignore())
                .ForMember(d => d.NhatKies, o => o.Ignore())
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.HoSoDaNops, o => o.Ignore())
                .ForMember(d => d.CauLacBoThamGias, o => o.Ignore())
                .ForMember(d => d.HinhAnh, o => o.Ignore());
        }
        public static void ConfigureThamGiaOlympicMapping()
        {
            Mapper.CreateMap<ThamGiaOlympic, ThamGiaOlympicDTO>();
            Mapper.CreateMap<ThamGiaOlympicDTO, ThamGiaOlympic>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.SinhVien, o => o.Ignore())
                .ForMember(d => d.SinhVienReference, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureThayDoiTrongQuaTrinhHocMapping()
        {
            Mapper.CreateMap<ThayDoiTrongQuaTrinhHoc, ThayDoiTrongQuaTrinhHocDTO>()
                .ForMember(t => t.TenGoi, o => o.MapFrom(s => s.LoaiThayDoi.TenGoi));
            Mapper.CreateMap<ThayDoiTrongQuaTrinhHocDTO, ThayDoiTrongQuaTrinhHoc>().IgnoreAllNonExisting();
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureTonGiaoMapping()
        {
            Mapper.CreateMap<TonGiao, TonGiaoDTO>();
            Mapper.CreateMap<TonGiaoDTO, TonGiao>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.SinhViens, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureVanBangDuocNhanMapping()
        {
            Mapper.CreateMap<VanBangDuocNhan, VanBangDuocNhanDTO>()
                .ForMember(d => d.TenGoi, o => o.MapFrom(s => s.LoaiVanBang.TenGoi));
            Mapper.CreateMap<VanBangDuocNhanDTO, VanBangDuocNhan>().IgnoreAllNonExisting();
            //.ForMember(v => v.EntityKey, o => o.Ignore())
            //.ForMember(v => v.SinhVien, o => o.Ignore())
            //.ForMember(v => v.SinhVienReference, o => o.Ignore());
            Mapper.AssertConfigurationIsValid();
        }
        public static void ConfigureUserMapping()
        {
            Mapper.CreateMap<User, UserDTO>()
                .ForMember(d => d.DanhSachQuyen, o => o.Ignore())
                .ForMember(d => d.DanhSachDonVi, o => o.Ignore());
            Mapper.CreateMap<UserDTO, User>()
                .ForMember(d => d.EntityKey, o => o.Ignore())
                .ForMember(d => d.DonVis, o => o.Ignore());
        }
        #endregion

        #region CauLacBo Converter
        public static CauLacBoDTO ConvertToCauLacBoDTO(CauLacBo obj)
        {
            var objdto = Mapper.Map<CauLacBo, CauLacBoDTO>(obj);
            return objdto;
        }

        public static CauLacBo ConvertToCauLacBo(CauLacBoDTO objdto)
        {
            var obj = Mapper.Map<CauLacBoDTO, CauLacBo>(objdto);
            return obj;
        }

        public static ObservableCollection<CauLacBoDTO> ConvertToCauLacBoDTOList(ObservableCollection<CauLacBo> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<CauLacBo>, ObservableCollection<CauLacBoDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<CauLacBo> ConvertToCauLacBoList(ObservableCollection<CauLacBoDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<CauLacBoDTO>, ObservableCollection<CauLacBo>>(objdto);
            return obj;
        }

        #endregion

        #region CauLacBoThamGia Converter
        public static CauLacBoThamGiaDTO ConvertToCauLacBoThamGiaDTO(CauLacBoThamGia obj)
        {
            var objdto = Mapper.Map<CauLacBoThamGia, CauLacBoThamGiaDTO>(obj);
            return objdto;
        }

        public static CauLacBoThamGia ConvertToCauLacBoThamGia(CauLacBoThamGiaDTO objdto)
        {
            var obj = Mapper.Map<CauLacBoThamGiaDTO, CauLacBoThamGia>(objdto);
            return obj;
        }

        public static ObservableCollection<CauLacBoThamGiaDTO> ConvertToCauLacBoThamGiaDTOList(ObservableCollection<CauLacBoThamGia> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<CauLacBoThamGia>, ObservableCollection<CauLacBoThamGiaDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<CauLacBoThamGia> ConvertToCauLacBoThamGiaList(ObservableCollection<CauLacBoThamGiaDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<CauLacBoThamGiaDTO>, ObservableCollection<CauLacBoThamGia>>(objdto);
            return obj;
        }

        #endregion

        #region ChinhSach Converter
        public static ChinhSachDTO ConvertToChinhSachDTO(ChinhSach obj)
        {
            var objdto = Mapper.Map<ChinhSach, ChinhSachDTO>(obj);
            return objdto;
        }

        public static ChinhSach ConvertToChinhSach(ChinhSachDTO objdto)
        {
            var obj = Mapper.Map<ChinhSachDTO, ChinhSach>(objdto);
            return obj;
        }

        public static ObservableCollection<ChinhSachDTO> ConvertToChinhSachDTOList(ObservableCollection<ChinhSach> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<ChinhSach>, ObservableCollection<ChinhSachDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<ChinhSach> ConvertToChinhSachList(ObservableCollection<ChinhSachDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<ChinhSachDTO>, ObservableCollection<ChinhSach>>(objdto);
            return obj;
        }

        #endregion

        #region DanToc Converter
        public static DanTocDTO ConvertToDanTocDTO(DanToc obj)
        {
            var objdto = Mapper.Map<DanToc, DanTocDTO>(obj);
            return objdto;
        }

        public static DanToc ConvertToDanToc(DanTocDTO objdto)
        {
            var obj = Mapper.Map<DanTocDTO, DanToc>(objdto);
            return obj;
        }

        public static ObservableCollection<DanTocDTO> ConvertToDanTocDTOList(ObservableCollection<DanToc> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<DanToc>, ObservableCollection<DanTocDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<DanToc> ConvertToDanTocList(ObservableCollection<DanTocDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<DanTocDTO>, ObservableCollection<DanToc>>(objdto);
            return obj;
        }

        #endregion

        #region DonVi Converter
        public static DonViDTO ConvertToDonViDTO(DonVi obj)
        {
            var objdto = Mapper.Map<DonVi, DonViDTO>(obj);
            return objdto;
        }

        public static DonVi ConvertToDonVi(DonViDTO objdto)
        {
            var obj = Mapper.Map<DonViDTO, DonVi>(objdto);
            return obj;
        }

        public static ObservableCollection<DonViDTO> ConvertToDonViDTOList(ObservableCollection<DonVi> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<DonVi>, ObservableCollection<DonViDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<DonVi> ConvertToDonViList(ObservableCollection<DonViDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<DonViDTO>, ObservableCollection<DonVi>>(objdto);
            return obj;
        }
        #endregion

        #region DVHCCap1 Converter
        public static DVHCCap1DTO ConvertToDVHCCap1DTO(DVHCCap1 obj)
        {
            var objdto = Mapper.Map<DVHCCap1, DVHCCap1DTO>(obj);
            return objdto;
        }

        public static DVHCCap1 ConvertToDVHCCap1(DVHCCap1DTO objdto)
        {
            var obj = Mapper.Map<DVHCCap1DTO, DVHCCap1>(objdto);
            return obj;
        }

        public static ObservableCollection<DVHCCap1DTO> ConvertToDVHCCap1DTOList(ObservableCollection<DVHCCap1> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<DVHCCap1>, ObservableCollection<DVHCCap1DTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<DVHCCap1> ConvertToDVHCCap1List(ObservableCollection<DVHCCap1DTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<DVHCCap1DTO>, ObservableCollection<DVHCCap1>>(objdto);
            return obj;
        }

        public static DVHCCap1DetailDTO ConvertToDVHCCap1DetailDTO(DVHCCap1 obj)
        {
            var objdto = Mapper.Map<DVHCCap1, DVHCCap1DetailDTO>(obj);
            return objdto;
        }
        #endregion

        #region DVHCCap2 Converter
        public static DVHCCap2DTO ConvertToDVHCCap2DTO(DVHCCap2 obj)
        {
            var objdto = Mapper.Map<DVHCCap2, DVHCCap2DTO>(obj);
            return objdto;
        }

        public static DVHCCap2 ConvertToDVHCCap2(DVHCCap2DTO objdto)
        {
            var obj = Mapper.Map<DVHCCap2DTO, DVHCCap2>(objdto);
            return obj;
        }

        public static ObservableCollection<DVHCCap2DTO> ConvertToDVHCCap2DTOList(ObservableCollection<DVHCCap2> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<DVHCCap2>, ObservableCollection<DVHCCap2DTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<DVHCCap2> ConvertToDVHCCap1List(ObservableCollection<DVHCCap2DTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<DVHCCap2DTO>, ObservableCollection<DVHCCap2>>(objdto);
            return obj;
        }
        #endregion

        #region HoatDongDoanThe Converter
        public static HoatDongDoanTheDTO ConvertToHoatDongDoanTheDTO(HoatDongDoanThe obj)
        {
            var objdto = Mapper.Map<HoatDongDoanThe, HoatDongDoanTheDTO>(obj);
            return objdto;
        }

        public static HoatDongDoanThe ConvertToHoatDongDoanThe(HoatDongDoanTheDTO objdto)
        {
            var obj = Mapper.Map<HoatDongDoanTheDTO, HoatDongDoanThe>(objdto);
            return obj;
        }

        public static ObservableCollection<HoatDongDoanTheDTO> ConvertToHoatDongDoanTheDTOList(ObservableCollection<HoatDongDoanThe> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<HoatDongDoanThe>, ObservableCollection<HoatDongDoanTheDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<HoatDongDoanThe> ConvertToHoatDongDoanTheList(ObservableCollection<HoatDongDoanTheDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<HoatDongDoanTheDTO>, ObservableCollection<HoatDongDoanThe>>(objdto);
            return obj;
        }

        #endregion

        #region HoatDongDoanTheThamGia Converter
        public static HoatDongDoanTheThamGiaDTO ConvertToHoatDongDoanTheThamGiaDTO(HoatDongDoanTheThamGia obj)
        {
            var objdto = Mapper.Map<HoatDongDoanTheThamGia, HoatDongDoanTheThamGiaDTO>(obj);
            return objdto;
        }

        public static HoatDongDoanTheThamGia ConvertToHoatDongDoanTheThamGia(HoatDongDoanTheThamGiaDTO objdto)
        {
            var obj = Mapper.Map<HoatDongDoanTheThamGiaDTO, HoatDongDoanTheThamGia>(objdto);
            return obj;
        }

        public static ObservableCollection<HoatDongDoanTheThamGiaDTO> ConvertToHoatDongDoanTheThamGiaDTOList(ObservableCollection<HoatDongDoanTheThamGia> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<HoatDongDoanTheThamGia>, ObservableCollection<HoatDongDoanTheThamGiaDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<HoatDongDoanTheThamGia> ConvertToHoatDongDoanTheThamGiaList(ObservableCollection<HoatDongDoanTheThamGiaDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<HoatDongDoanTheThamGiaDTO>, ObservableCollection<HoatDongDoanTheThamGia>>(objdto);
            return obj;
        }

        #endregion

        #region HocBong Converter
        public static HocBongDTO ConvertToHocBongDTO(HocBong obj)
        {
            var objdto = Mapper.Map<HocBong, HocBongDTO>(obj);
            return objdto;
        }

        public static HocBong ConvertToHocBong(HocBongDTO objdto)
        {
            var obj = Mapper.Map<HocBongDTO, HocBong>(objdto);
            return obj;
        }

        public static ObservableCollection<HocBongDTO> ConvertToHocBongDTOList(ObservableCollection<HocBong> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<HocBong>, ObservableCollection<HocBongDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<HocBong> ConvertToHocBongList(ObservableCollection<HocBongDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<HocBongDTO>, ObservableCollection<HocBong>>(objdto);
            return obj;
        }

        #endregion

        #region HoSoDaNop Converter
        public static HoSoDaNop ConvertToHoSoDaNopFromView(HoSoNopList pobj)
        {
            var obj = Mapper.Map<HoSoNopList, HoSoDaNop>(pobj);
            return obj;
        }

        public static HoSoDaNopDTO ConvertToHoSoDaNopDTO(HoSoDaNop obj)
        {
            var objdto = Mapper.Map<HoSoDaNop, HoSoDaNopDTO>(obj);
            return objdto;
        }

        public static HoSoDaNop ConvertToHoSoDaNop(HoSoDaNopDTO objdto)
        {
            var obj = Mapper.Map<HoSoDaNopDTO, HoSoDaNop>(objdto);
            return obj;
        }

        public static ObservableCollection<HoSoDaNopDTO> ConvertToHoSoDaNopDTOList(ObservableCollection<HoSoDaNop> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<HoSoDaNop>, ObservableCollection<HoSoDaNopDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<HoSoDaNop> ConvertToHoSoDaNopList(ObservableCollection<HoSoDaNopDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<HoSoDaNopDTO>, ObservableCollection<HoSoDaNop>>(objdto);
            return obj;
        }

        public static ObservableCollection<HoSoDaNopDTO> ConvertToHoSoDaNopDTOListFromView(ObservableCollection<HoSoNopList> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<HoSoNopList>, ObservableCollection<HoSoDaNopDTO>>(obj);
            return objdto;
        }

        #endregion

        #region KhenThuong Converter
        public static KhenThuongDTO ConvertToKhenThuongDTO(KhenThuong obj)
        {
            var objdto = Mapper.Map<KhenThuong, KhenThuongDTO>(obj);
            return objdto;
        }

        public static KhenThuong ConvertToKhenThuong(KhenThuongDTO objdto)
        {
            var obj = Mapper.Map<KhenThuongDTO, KhenThuong>(objdto);
            return obj;
        }

        public static ObservableCollection<KhenThuongDTO> ConvertToKhenThuongDTOList(ObservableCollection<KhenThuong> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<KhenThuong>, ObservableCollection<KhenThuongDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<KhenThuong> ConvertToKhenThuongList(ObservableCollection<KhenThuongDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<KhenThuongDTO>, ObservableCollection<KhenThuong>>(objdto);
            return obj;
        }

        #endregion

        #region KhoaHoc Converter
        public static KhoaHocDTO ConvertToKhoaHocDTO(KhoaHoc obj)
        {
            var objdto = Mapper.Map<KhoaHoc, KhoaHocDTO>(obj);
            return objdto;
        }

        public static KhoaHoc ConvertToKhoaHoc(KhoaHocDTO objdto)
        {
            var obj = Mapper.Map<KhoaHocDTO, KhoaHoc>(objdto);
            return obj;
        }

        public static ObservableCollection<KhoaHocDTO> ConvertToKhoaHocDTOList(ObservableCollection<KhoaHoc> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<KhoaHoc>, ObservableCollection<KhoaHocDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<KhoaHoc> ConvertToKhoaHocList(ObservableCollection<KhoaHocDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<KhoaHocDTO>, ObservableCollection<KhoaHoc>>(objdto);
            return obj;
        }
        #endregion

        #region KyLuat Converter
        public static KyLuatDTO ConvertToKyLuatDTO(KyLuat obj)
        {
            var objdto = Mapper.Map<KyLuat, KyLuatDTO>(obj);
            return objdto;
        }

        public static KyLuat ConvertToKyLuat(KyLuatDTO objdto)
        {
            var obj = Mapper.Map<KyLuatDTO, KyLuat>(objdto);
            return obj;
        }

        public static ObservableCollection<KyLuatDTO> ConvertToKyLuatDTOList(ObservableCollection<KyLuat> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<KyLuat>, ObservableCollection<KyLuatDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<KyLuat> ConvertToKyLuatList(ObservableCollection<KyLuatDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<KyLuatDTO>, ObservableCollection<KyLuat>>(objdto);
            return obj;
        }

        #endregion

        #region LoaiHoSo Converter
        public static LoaiHoSoDTO ConvertToLoaiHoSoDTO(LoaiHoSo obj)
        {
            var objdto = Mapper.Map<LoaiHoSo, LoaiHoSoDTO>(obj);
            return objdto;
        }

        public static LoaiHoSo ConvertToLoaiHoSo(LoaiHoSoDTO objdto)
        {
            var obj = Mapper.Map<LoaiHoSoDTO, LoaiHoSo>(objdto);
            return obj;
        }

        public static ObservableCollection<LoaiHoSoDTO> ConvertToLoaiHoSoDTOList(ObservableCollection<LoaiHoSo> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<LoaiHoSo>, ObservableCollection<LoaiHoSoDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<LoaiHoSo> ConvertToLoaiHoSoList(ObservableCollection<LoaiHoSoDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<LoaiHoSoDTO>, ObservableCollection<LoaiHoSo>>(objdto);
            return obj;
        }

        #endregion

        #region LoaiThayDoi Converter
        public static LoaiThayDoiDTO ConvertToLoaiThayDoiDTO(LoaiThayDoi obj)
        {
            var objdto = Mapper.Map<LoaiThayDoi, LoaiThayDoiDTO>(obj);
            return objdto;
        }

        public static LoaiThayDoi ConvertToLoaiThayDoi(LoaiThayDoiDTO objdto)
        {
            var obj = Mapper.Map<LoaiThayDoiDTO, LoaiThayDoi>(objdto);
            return obj;
        }

        public static ObservableCollection<LoaiThayDoiDTO> ConvertToLoaiThayDoiDTOList(ObservableCollection<LoaiThayDoi> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<LoaiThayDoi>, ObservableCollection<LoaiThayDoiDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<LoaiThayDoi> ConvertToLoaiThayDoiList(ObservableCollection<LoaiThayDoiDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<LoaiThayDoiDTO>, ObservableCollection<LoaiThayDoi>>(objdto);
            return obj;
        }

        #endregion

        #region LoaiVanBang Converter
        public static LoaiVanBangDTO ConvertToLoaiVanBangDTO(LoaiVanBang obj)
        {
            var objdto = Mapper.Map<LoaiVanBang, LoaiVanBangDTO>(obj);
            return objdto;
        }

        public static LoaiVanBang ConvertToLoaiVanBang(LoaiVanBangDTO objdto)
        {
            var obj = Mapper.Map<LoaiVanBangDTO, LoaiVanBang>(objdto);
            return obj;
        }

        public static ObservableCollection<LoaiVanBangDTO> ConvertToLoaiVanBangDTOList(ObservableCollection<LoaiVanBang> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<LoaiVanBang>, ObservableCollection<LoaiVanBangDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<LoaiVanBang> ConvertToLoaiVanBangList(ObservableCollection<LoaiVanBangDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<LoaiVanBangDTO>, ObservableCollection<LoaiVanBang>>(objdto);
            return obj;
        }
        #endregion

        #region Lop Converter
        public static LopDTO ConvertToLopDTO(Lop obj)
        {
            var objdto = Mapper.Map<Lop, LopDTO>(obj);
            return objdto;
        }

        public static Lop ConvertToLop(LopDTO objdto)
        {
            var obj = Mapper.Map<LopDTO, Lop>(objdto);
            return obj;
        }

        public static ObservableCollection<LopDTO> ConvertToLopDTOList(ObservableCollection<Lop> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<Lop>, ObservableCollection<LopDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<Lop> ConvertToLopList(ObservableCollection<LopDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<LopDTO>, ObservableCollection<Lop>>(objdto);
            return obj;
        }
        #endregion

        #region MonHoc Converter
        public static MonHocDTO ConvertToMonHocDTO(MonHoc obj)
        {
            var objdto = Mapper.Map<MonHoc, MonHocDTO>(obj);
            return objdto;
        }

        public static MonHoc ConvertToMonHoc(MonHocDTO objdto)
        {
            var obj = Mapper.Map<MonHocDTO, MonHoc>(objdto);
            return obj;
        }

        public static ObservableCollection<MonHocDTO> ConvertToMonHocDTOList(ObservableCollection<MonHoc> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<MonHoc>, ObservableCollection<MonHocDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<MonHoc> ConvertToMonHocList(ObservableCollection<MonHocDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<MonHocDTO>, ObservableCollection<MonHoc>>(objdto);
            return obj;
        }

        #endregion

        #region NghienCuuKhoaHoc Converter
        public static NghienCuuKhoaHocDTO ConvertToNghienCuuKhoaHocDTO(NghienCuuKhoaHoc obj)
        {
            var objdto = Mapper.Map<NghienCuuKhoaHoc, NghienCuuKhoaHocDTO>(obj);
            return objdto;
        }

        public static NghienCuuKhoaHoc ConvertToNghienCuuKhoaHoc(NghienCuuKhoaHocDTO objdto)
        {
            var obj = Mapper.Map<NghienCuuKhoaHocDTO, NghienCuuKhoaHoc>(objdto);
            return obj;
        }

        public static ObservableCollection<NghienCuuKhoaHocDTO> ConvertToNghienCuuKhoaHocDTOList(ObservableCollection<NghienCuuKhoaHoc> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<NghienCuuKhoaHoc>, ObservableCollection<NghienCuuKhoaHocDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<NghienCuuKhoaHoc> ConvertToNghienCuuKhoaHocList(ObservableCollection<NghienCuuKhoaHocDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<NghienCuuKhoaHocDTO>, ObservableCollection<NghienCuuKhoaHoc>>(objdto);
            return obj;
        }

        #endregion

        #region NhatKy Converter
        public static NhatKyDTO ConvertToNhatKyDTO(NhatKy obj)
        {
            var objdto = Mapper.Map<NhatKy, NhatKyDTO>(obj);
            return objdto;
        }

        public static NhatKy ConvertToNhatKy(NhatKyDTO objdto)
        {
            var obj = Mapper.Map<NhatKyDTO, NhatKy>(objdto);
            return obj;
        }

        public static ObservableCollection<NhatKyDTO> ConvertToNhatKyDTOList(ObservableCollection<NhatKy> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<NhatKy>, ObservableCollection<NhatKyDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<NhatKy> ConvertToNhatKyList(ObservableCollection<NhatKyDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<NhatKyDTO>, ObservableCollection<NhatKy>>(objdto);
            return obj;
        }
        #endregion

        #region PhienBanGiao Converter
        public static PhienBanGiaoDTO ConvertToPhienBanGiaoDTO(PhienBanGiao obj)
        {
            var objdto = Mapper.Map<PhienBanGiao, PhienBanGiaoDTO>(obj);
            return objdto;
        }

        public static PhienBanGiao ConvertToPhienBanGiao(PhienBanGiaoDTO objdto)
        {
            var obj = Mapper.Map<PhienBanGiaoDTO, PhienBanGiao>(objdto);
            return obj;
        }

        public static ObservableCollection<PhienBanGiaoDTO> ConvertToPhienBanGiaoDTOList(ObservableCollection<PhienBanGiao> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<PhienBanGiao>, ObservableCollection<PhienBanGiaoDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<PhienBanGiao> ConvertToPhienBanGiaoList(ObservableCollection<PhienBanGiaoDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<PhienBanGiaoDTO>, ObservableCollection<PhienBanGiao>>(objdto);
            return obj;
        }

        #endregion

        #region Quyen Converter
        public static QuyenDTO ConvertToQuyenDTO(Quyen obj)
        {
            var objdto = Mapper.Map<Quyen, QuyenDTO>(obj);
            return objdto;
        }

        public static Quyen ConvertToQuyen(QuyenDTO objdto)
        {
            var obj = Mapper.Map<QuyenDTO, Quyen>(objdto);
            return obj;
        }

        public static ObservableCollection<QuyenDTO> ConvertToQuyenDTOList(ObservableCollection<Quyen> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<Quyen>, ObservableCollection<QuyenDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<Quyen> ConvertToQuyenList(ObservableCollection<QuyenDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<QuyenDTO>, ObservableCollection<Quyen>>(objdto);
            return obj;
        }
        #endregion

        #region SinhVien Converter
        public static SinhVienBasicDTO ConvertToSinhVienBasicDTO(SinhVien obj)
        {
            var objdto = Mapper.Map<SinhVien, SinhVienBasicDTO>(obj);
            return objdto;
        }

        public static SinhVien ConvertToSinhVien(SinhVienDetailDTO objdto)
        {

            var obj = Mapper.Map<SinhVienDetailDTO, SinhVien>(objdto);
            return obj;
        }

        public static ObservableCollection<SinhVienBasicDTO> ConvertToSinhVienBasicDTOList(ObservableCollection<SinhVien> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<SinhVien>, ObservableCollection<SinhVienBasicDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<SinhVien> ConvertToSinhVienList(ObservableCollection<SinhVienBasicDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<SinhVienBasicDTO>, ObservableCollection<SinhVien>>(objdto);
            return obj;
        }

        public static SinhVienDetailDTO ConvertToSinhVienDetail(SinhVien obj)
        {

            var objdto = Mapper.Map<SinhVien, SinhVienDetailDTO>(obj);
            return objdto;
        }
        #endregion

        #region ThamGiaOlympic Converter
        public static ThamGiaOlympicDTO ConvertToThamGiaOlympicDTO(ThamGiaOlympic obj)
        {
            var objdto = Mapper.Map<ThamGiaOlympic, ThamGiaOlympicDTO>(obj);
            return objdto;
        }

        public static ThamGiaOlympic ConvertToThamGiaOlympic(ThamGiaOlympicDTO objdto)
        {
            var obj = Mapper.Map<ThamGiaOlympicDTO, ThamGiaOlympic>(objdto);
            return obj;
        }

        public static ObservableCollection<ThamGiaOlympicDTO> ConvertToThamGiaOlympicDTOList(ObservableCollection<ThamGiaOlympic> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<ThamGiaOlympic>, ObservableCollection<ThamGiaOlympicDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<ThamGiaOlympic> ConvertToThamGiaOlympicList(ObservableCollection<ThamGiaOlympicDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<ThamGiaOlympicDTO>, ObservableCollection<ThamGiaOlympic>>(objdto);
            return obj;
        }

        #endregion

        #region ThayDoiTrongQuaTrinhHoc Converter
        public static ThayDoiTrongQuaTrinhHocDTO ConvertToThayDoiTrongQuaTrinhHocDTO(ThayDoiTrongQuaTrinhHoc obj)
        {
            var objdto = Mapper.Map<ThayDoiTrongQuaTrinhHoc, ThayDoiTrongQuaTrinhHocDTO>(obj);
            return objdto;
        }

        public static ThayDoiTrongQuaTrinhHoc ConvertToThayDoiTrongQuaTrinhHoc(ThayDoiTrongQuaTrinhHocDTO objdto)
        {
            var obj = Mapper.Map<ThayDoiTrongQuaTrinhHocDTO, ThayDoiTrongQuaTrinhHoc>(objdto);
            return obj;
        }

        public static ObservableCollection<ThayDoiTrongQuaTrinhHocDTO> ConvertToThayDoiTrongQuaTrinhHocDTOList(ObservableCollection<ThayDoiTrongQuaTrinhHoc> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<ThayDoiTrongQuaTrinhHoc>, ObservableCollection<ThayDoiTrongQuaTrinhHocDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<ThayDoiTrongQuaTrinhHoc> ConvertToThayDoiTrongQuaTrinhHocList(ObservableCollection<ThayDoiTrongQuaTrinhHocDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<ThayDoiTrongQuaTrinhHocDTO>, ObservableCollection<ThayDoiTrongQuaTrinhHoc>>(objdto);
            return obj;
        }

        #endregion

        #region TonGiao Converter
        public static TonGiaoDTO ConvertToTonGiaoDTO(TonGiao obj)
        {
            var objdto = Mapper.Map<TonGiao, TonGiaoDTO>(obj);
            return objdto;
        }

        public static TonGiao ConvertToTonGiao(TonGiaoDTO objdto)
        {
            var obj = Mapper.Map<TonGiaoDTO, TonGiao>(objdto);
            return obj;
        }

        public static ObservableCollection<TonGiaoDTO> ConvertToTonGiaoDTOList(ObservableCollection<TonGiao> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<TonGiao>, ObservableCollection<TonGiaoDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<TonGiao> ConvertToTonGiaoList(ObservableCollection<TonGiaoDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<TonGiaoDTO>, ObservableCollection<TonGiao>>(objdto);
            return obj;
        }

        #endregion

        #region VanBangDuocNhan Converter
        public static VanBangDuocNhanDTO ConvertToVanBangDuocNhanDTO(VanBangDuocNhan obj)
        {
            var objdto = Mapper.Map<VanBangDuocNhan, VanBangDuocNhanDTO>(obj);
            return objdto;
        }

        public static VanBangDuocNhan ConvertToVanBangDuocNhan(VanBangDuocNhanDTO objdto)
        {
            var obj = Mapper.Map<VanBangDuocNhanDTO, VanBangDuocNhan>(objdto);
            return obj;
        }

        public static ObservableCollection<VanBangDuocNhanDTO> ConvertToVanBangDuocNhanDTOList(ObservableCollection<VanBangDuocNhan> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<VanBangDuocNhan>, ObservableCollection<VanBangDuocNhanDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<VanBangDuocNhan> ConvertToVanBangDuocNhanList(ObservableCollection<VanBangDuocNhanDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<VanBangDuocNhanDTO>, ObservableCollection<VanBangDuocNhan>>(objdto);
            return obj;
        }

        #endregion

        #region User Converter
        public static UserDTO ConvertToUserDTO(User obj)
        {
            var objdto = Mapper.Map<User, UserDTO>(obj);
            return objdto;
        }

        public static User ConvertToUser(UserDTO objdto)
        {
            var obj = Mapper.Map<UserDTO, User>(objdto);
            return obj;
        }

        public static ObservableCollection<UserDTO> ConvertToUserDTOList(ObservableCollection<User> obj)
        {
            var objdto = Mapper.Map<ObservableCollection<User>, ObservableCollection<UserDTO>>(obj);
            return objdto;
        }

        public static ObservableCollection<User> ConvertToUserList(ObservableCollection<UserDTO> objdto)
        {
            var obj = Mapper.Map<ObservableCollection<UserDTO>, ObservableCollection<User>>(objdto);
            return obj;
        }

        #endregion

        #region Private Methods
        public static IMappingExpression<TSource, TDestination> IgnoreAllNonExisting<TSource, TDestination>(this IMappingExpression<TSource, TDestination> expression)
        {
            var sourceType = typeof(TSource);
            var destinationType = typeof(TDestination);
            var existingMaps = Mapper.GetAllTypeMaps().First(x => x.SourceType.Equals(sourceType)
                && x.DestinationType.Equals(destinationType));
            foreach (var property in existingMaps.GetUnmappedPropertyNames())
            {
                expression.ForMember(property, opt => opt.Ignore());
            }
            return expression;
        }

        #endregion
    }
}
